package BiShi.first;

import java.util.*;
public class Main22{
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        while(sc.hasNext()){
            int n = sc.nextInt();
            long[] a = new long[n];
            for (int i = 0;i<a.length;i++){
                a[i] = sc.nextInt();
            }
            Arrays.sort(a);
            int k = 0;
            while(a[n-1]>=n){
                a[n-1]-=n;
                for (int i = 0;i<a.length-1;i++){
                    a[i]++;
                }
                k++;
                Arrays.sort(a);
            }
            System.out.println(k);
        }
    }
}
